/*
 * @Author: CodeHare
 * @Date: 2023-10-16 19:16:04
 * @LastEditors: yangni 920556271@qq.com
 * @LastEditTime: 2024-04-10 14:40:26
 * @Description:  空调参数设置
 */

import 'package:get/get.dart';
import 'package:yt_devops/model/device_obj/output_data_model.dart';
import 'package:yt_devops/model/device_obj/properties_model.dart';
import 'package:yt_devops/model/device_obj/services_model.dart';
import 'package:yt_devops/resources/str_res_keys.dart';

class AirConditionSettingModel {
  AirConditionSettingModel();

  /// 运行参数设置模型
  ServicesModel? runParameterModel;

  /// 定值参数设置模型
  ServicesModel? fixedParameterModel;

  /// 设备数据值
  Map<String, dynamic> deviceData = {};

  ServicesModel getBwtFixedParameterModel(List model) {
    var propertyIdList = [
      'RefrigerationPoint',
      'HeatingPoint',
      'HeatingReturnDifference',
      'DehumidificationPoint',
      'DehumidificationReturnDifference',
      'HighTemperaturePoint',
      'LowTemperaturePoint',
      'HighHumidityPoint',
      'InternalFanStopPoint',
      'HighTemperatureOpeningValue',
      'HighTemperatureShutdownValue',
      'LowTemperatureOpeningValue',
      'LowTemperatureShutdownValue'
    ];
    List<OutputDataModel> outputDataList = [];
    for (var p in propertyIdList) {
      var map = model.firstWhere((element) => element['id'] == p);

      outputDataList.add(OutputDataModel.fromJson(map as Map<String, dynamic>));
    }

    return ServicesModel(
        id: 'SettingOfOperatingConstantValue',
        groupName: ResKey.deviceRunFixedValueSetting.tr,
        name: ResKey.deviceRunFixedValueSetting.tr,
        outputData: outputDataList,
        accessType: 'push');
  }
}
